home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MISC.SWG / 0106_'C' Printf.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  2KB  |  89 lines

  1. USES CRT,DOS;
  2.  
  3. (*   Here is a procedure I made that does ABOUT the same thing as the 'C'
  4.    Printf Does. Could someone help me add a few more features? *)
  5.  
  6. PROCEDURE Printf(Str : String);
  7. Var
  8.    X : Integer;
  9.    y : integer;
  10.    ky: char;
  11.    d : boolean;
  12.  
  13. begin
  14.      d:=false;
  15.      x:=0;
  16.      ky:=' ';
  17.      for x:=1 to length(str) do
  18.          begin
  19.               ky:=str[x];
  20.               if (ky='\') and (not d) then
  21.                  d:=true
  22.               Else
  23.               If (Ky='\') and (d) then
  24.                  begin
  25.                       write('\');
  26.                       d:=false;
  27.                  end
  28.               Else
  29.               if (ky='n') and (D) or (ky='N') And (D) then
  30.                  begin
  31.                       writeln;
  32.                       d:=false;
  33.                  end
  34.               else
  35.               if (Upcase(ky)='T') and (D) then
  36.                  begin
  37.                       write('        ');
  38.                       d:=false;
  39.                  end
  40.               else
  41.               if (Upcase(ky)='B') and (D) then
  42.                  begin
  43.                       write(#8);
  44.                       d:=false;
  45.                  end
  46.               else
  47.               if (Upcase(ky)='R') and (D) then
  48.                  begin
  49.                       write(#13);
  50.                       d:=false;
  51.                  end
  52.               else
  53.               if (Upcase(ky)='F') and (D) then
  54.                  begin
  55.                       write(#12);
  56.                       d:=false;
  57.                  end
  58.  
  59.               else
  60.               if (Upcase(ky)='G') and (D) then
  61.                  begin
  62.                       write(#7);
  63.                       d:=false;
  64.                  end
  65.  
  66.               else
  67.  
  68.               if (not d) and (ky<>'\') then
  69.                  begin
  70.                       write(ky);
  71.                       d:=false;
  72.                  end;
  73.  
  74.          End;
  75. End;
  76.  
  77. Begin
  78.      ClrScr;
  79.      Printf('This is a Printf() procedure. a \\n will make a new line.\nSee??');
  80.      Printf(' Making a \\\\ will display a \\. Try it! Make a \\\\n to make a');
  81.      printf('\nAlso, a \\b will back space. \\r will carriage return. \\f is f');
  82.      printf('.\n\\t is tab.\\gIs Beep Eg\tI just tabed.\n\rI just carriage ret');
  83.      printf('1234567890\b. There was a 0 after the 9. I backspased over it and');
  84.      Printf('\g\gI beeped twice by: \\g\\g\n\n\n\n');
  85. End.
  86.  
  87.  
  88.  
  89.